package SI::Person::Status;

use base  qw/MyDB::Object/;



__PACKAGE__->meta->setup(
    table => 'PersonStatus',
    columns =>
    [
        code => { type => 'varchar', length => 2, not_null => 1 },
        value => { type => 'varchar', length => 60, not_null => 1 },
    ],
    allow_inline_column_values => 1,
    primary_key_columns => [ 'code' ],
);

sub init_tab {
    my $self = shift;
    my $stmt = 'CREATE TABLE PersonStatus (
    code VARCHAR(2) PRIMARY KEY NOT NULL, /* 状态码 */
    value VARCHAR(60) NOT NULL            /* 状态值 */
    );';
    my $db = $self->init_db;
    my $dbh = $db->dbh or die $db->error;
    $db->do_transaction(sub {$dbh->do($stmt)})
        or die $db->error;
    return 1;

}











1;
